/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.ejb.EJB;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import ro.tni.sessionbeans.PersisterDAO;
import ro.tni.sessionbeans.PersisterDAOLocal;

/**
 *
 * @author radus
 */
@Entity
@Table(name = "dudes")
@NamedQueries({
    @NamedQuery(name = "Dude.findAll", query = "SELECT d FROM Dude d"),
    @NamedQuery(name = "Dude.findByName", query = "SELECT d FROM Dude d WHERE d.name = :name"),
    @NamedQuery(name = "Dude.findByIq", query = "SELECT d FROM Dude d WHERE d.iq = :iq")})
public class Dude implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "name")
    private String name;
    @Size(max = 10)
    @Column(name = "iq")
    private String iq;
    
    public Dude() {
    }

    public Dude(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIq() {
        return iq;
    }

    public void setIq(String iq) {
        this.iq = iq;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (name != null ? name.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dude)) {
            return false;
        }
        Dude other = (Dude) object;
        if ((this.name == null && other.name != null) || (this.name != null && !this.name.equals(other.name))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Dude[ name=" + name + " ]";
    }
    
}
